import { empty_void_func } from '../../../global/Types';
import { css_disnone } from '../Css';
import { inject_dom_func_promise } from './inject_dom';
import { remove_class } from './remove_class';
import { remove_dom_func_promise } from './remove_dom';

/**
 * 移除 元素 并 追加 class css_disnone
 */
export function remove_chi(elt: HTMLElement, res = empty_void_func) {
  return async () => {
    // console.log(elt);
    await remove_dom_func_promise(elt);
    remove_class(elt, css_disnone, true);

    res();
  };
}

/**
 * 添加 元素
 */
export function inject_chi(elt: HTMLElement, res = empty_void_func) {
  return async () => {
    await inject_dom_func_promise(elt);

    res();
  };
}
